package com.zzty.txj1.service.impl;

import com.zzty.txj1.dao.SelfExamDao;
import com.zzty.txj1.dao.SelfExamMapper;
import com.zzty.txj1.entity.Search;
import com.zzty.txj1.entity.SelfExam;
import com.zzty.txj1.entity.SelfExamTransaction;
import com.zzty.txj1.service.SelfExamService;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class SelfExamServiceImpl implements SelfExamService {
    private static final org.slf4j.Logger logger = LoggerFactory.getLogger(SelfExamServiceImpl.class);

    @Autowired
    SelfExamMapper selfExamMapper;

    @Autowired
    SelfExamDao selfExamDao;
    @Override
    public Integer checkDate(String date) {
        Integer count=selfExamMapper.checkDate(date);
        System.out.println("checkDate count: "+count);
        return count;
    }

    @Override
    public Integer addSelfExamQuestion(SelfExam selfExam) {
        Integer count=selfExamMapper.addQuestionId(selfExam);
        System.out.println("addSelfExamQuestion count: "+count);
        return count;
    }

    @Override
    public List<SelfExam> getSelfExam(Search search) {
        List<SelfExam> selfExams=selfExamDao.getSelfExam(search);
        return selfExams;
    }


    @Override
    public SelfExam checkByDateAndClazzId(SelfExam selfExam) {
        SelfExam selfExam1=selfExamDao.checkByDateAndClazzId(selfExam);
        return  selfExam1;
    }

    @Override
    public Integer insertTeamExam(SelfExam selfExam) {
        Integer count=selfExamDao.insertSelfExam(selfExam);
        return count;
    }

    @Override
    public List<SelfExam> getSelfExamByClazzId(SelfExam selfExam) {
        List<SelfExam> selfExams=new ArrayList<>();
        selfExams=selfExamDao.getSelfExamByClazzId(selfExam);
        return selfExams;
    }
    @Override
    public SelfExam getSelfExamById(SelfExamTransaction selfExamTransaction) {
        SelfExam selfExam=selfExamDao.getSelfExamById(selfExamTransaction);
        return selfExam;
    }

}
